package com.hqyj.springBoot.modules.common.dao;

import com.hqyj.springBoot.modules.common.entity.ExceptionLog;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

/**
 * ExceptionLogDao
 */
@Repository
@Mapper
public interface ExceptionLogDao {

    @Insert("insert into common_exception_log " +
            "(create_date,update_date,ip,path,class_name,method_name,exception_type,exception_message) " +
            "values (#{createDate},#{updateDate},#{ip},#{path},#{className},#{methodName}," +
            "#{exceptionType},#{exceptionMessage})")
    @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
    void insertExceptionLog(ExceptionLog exceptionLog);

    @Select("select * from common_exception_log where path = #{path}" +
            "and method_name = #{methodName} and exception_type = #{exceptionType} limit 1")
    ExceptionLog getExceptionLogByParam(@Param("path") String path ,
                                        @Param("methodName") String methodName ,
                                        @Param("exceptionType") String exceptionType);

}
